<template>
  <view class="disFlxAC gap-8 flexEnd" @click="toSelectMember">
    <text class="fz-14 linh-20" style="color: #999996">
      {{ modelValue ? '已选择' : '请选择代发会员' }}
    </text>
    <text class="ali-icon icon-you1 fz-16" style="color: #999996"></text>
  </view>
</template>
<script lang="ts" setup>
  import { MemberRoleEnum } from '@/enums/memberRoleEnum';
  import { navigateTo } from '@/router';
  const props = defineProps({
    modelValue: {
      type: Number,
      default: undefined,
    },
  });

  const emits = defineEmits(['update:modelValue']);

  const toSelectMember = () => {
    navigateTo({
      name: 'publicSelectUserList',
      options: {
        type: 'radio',
        dataSource: 'memberList',
        initRoleIds: [MemberRoleEnum.PRINCIPAL],
        selectedList: props.modelValue ? [props.modelValue] : [],
        success: (val) => {
          emits('update:modelValue', val[0]);
        },
      },
    });
  };
</script>
<style lang="scss" scoped></style>
